package vfs.server.command;

import vfs.common.Locale;
import vfs.common.Regex;
import vfs.common.command.AbstractCommandFactory;
import vfs.common.command.Command;
import vfs.common.command.CommandFactory;
import vfs.common.command.UnknownCommand;

/**
 * User: serge
 * Date: 19.11.13
 * Time: 3:14
 */
public class ServerCommandFactory extends AbstractCommandFactory implements CommandFactory
{
    private static final ServerCommandFactory ourInstance = new ServerCommandFactory();

    private ServerCommandFactory()
    {
    }

    public static ServerCommandFactory getInstance()
    {
        return ourInstance;
    }

    @Override
    public Command getCommand(String call)
    {
        splitCall(call);

        if (Regex.stringMatchesMask(param0, Locale.CMD_QUIT, true))
        {
            return new QuitCommand();
        }
        else
        {
            return new UnknownCommand();
        }
    }
}
